<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="../../js/jquery.js"></script>
</head>

<body>
<form>
  <div class="place"> <span>位置：</span>
    <ul class="placeul">
      <li>个人办公</li>
      <li>名片夹列表</li>
      <li>添加名片夹</li>
    </ul>
  </div>
  <div class="formbody">
    <div class="formtitle"><span>客户信息</span></div>
    <ul class="forminfo">
      <li>
        <label>名片夹名称</label>
        <input name="name" type="text" class="dfinput" />
        <i>必填，不能超过30个字符</i>
      </li>
      <li>
        <label>是否公开</label>
        <select class="dfselect">
          <option value="1">公开</option>
          <option value="0">不公开</option>
        </select>
        <i>必选</i>
      </li>
      <li>
        <label>创建人</label>
        <input type="text" th:value="${session.user.uname}" value="马云" readonly="readonly" class="roinput" />
        <i>不能编辑</i>
      </li>
      <li>
        <label>&nbsp;</label>
        <input type="button" class="btn sub" value="确定"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input name="" type="button" class="btn" value="返回" onclick="window.location.href='/office/queryContactsTypeList'"/>
      </li>
    </ul>
  </div>
</form>
</body>
</html>
<script type="text/javascript">
  $(function () {
    function submit(){
    var name = $("input[name='name']").val();
    var IsPublic = $('.dfselect').val();
    $.ajax({
      url:"/office/AddContact",
      type:'post',
      data:{'name':name,'IsPublic':IsPublic},
      dataType:'json',
      success:function (result) {
        if (result){
          alert("添加成功");
        }else {
          alert("添加失败，请重试");
        }
      }
    })
  }
  $('.sub').click(function () {
      submit();
    })
  })
</script>
